Prebuilt SpatiaLite loadable extension for Android and iOS, ready to drop into React Native apps using op-sqlite.
Prebuilt SpatiaLite loadable extension for Android and iOS, ready to drop into React Native apps using op-sqlite.
You don't need to build anything. Download the prebuilt binaries from GitHub Releases and follow the usage instructions below.
spatialite-android-<version>.zip from the latest releaseandroid/app/src/main/jniLibs/:hljs jniLibs/
├── arm64-v8a/libspatialite.so
├── armeabi-v7a/libspatialite.so
├── x86/libspatialite.so
└── x86_64/libspatialite.so
import { open } from "@op-engineering/op-sqlite";
const db = open({ name: "myDB" });
db.loadExtension("libspatialite", "sqlite3_modspatialite_init");
spatialite-ios-<version>.zip from the latest releaseNote: iOS requires op-sqlite to be built with extension loading enabled. The embedded iOS SQLite does not support runtime extensions by default.
This repo contains build recipes only — no vendored source trees or prebuilt binaries in git. Dependencies are downloaded on demand when you run a build.
jq (for parsing deps.json)curl, tar, unziphljs react-native-spatialite-artifacts/
├── deps.json # Pinned dependency versions and download URLs
├── mise.toml # Task definitions (fetch, build, verify, release)
├── scripts/
│ ├── fetch-sources.sh # Downloads deps → vendor/, symlinks to android/jni/
│ ├── build-android.sh # ndk-build wrapper with NDK auto-detection
│ ├── build-ios.sh # Xcode/clang cross-compile for device + simulator
│ ├── verify-android.sh # Checks entry point symbol + 16KB ELF alignment
│ └── release.sh # Packages zips and creates GitHub release via gh CLI
├── android/
│ └── jni/ # Android.mk + per-library .mk files (symlinks to vendor/)
├── ios/ # iOS build output (lib/, include/) — gitignored
├── vendor/ # Downloaded source trees — gitignored
└── dist/ # Release zips — gitignored
mise run fetch
# or: bash scripts/fetch-sources.sh
Downloads all source tarballs (~20 MB compressed) into vendor/ and creates symlinks in android/jni/ so the existing .mk files work without modification.
# Android (requires ANDROID_NDK_HOME or NDK in ~/Android/Sdk/ndk/)
mise run build:android
# iOS (requires macOS + Xcode)
mise run build:ios
Android output: android/libs/{arm64-v8a,armeabi-v7a,x86,x86_64}/libspatialite.so
iOS output: ios/lib/*.a + ios/include/
mise run verify:android
Checks that:
sqlite3_modspatialite_init symbol is exported in each .soInstall GitHub CLI (one of):
bash scripts/install-gh.sh # installs to ~/.local/bin
mise install # gh + jq via mise.toml (needs GitHub API quota)
sudo apt install gh jq zip # Debian/Ubuntu
Authenticate:
gh auth login
# or export GITHUB_TOKEN=ghp_... # fine-grained token with Contents: Read and write
Package only (no upload):
mise run package
# or: bash scripts/package-artifacts.sh 5.0.0
Publish a GitHub release (local):
mise run release -- 5.0.0
# or: bash scripts/release.sh --yes 5.0.0
This will:
.so files and iOS static libs (if built) into dist/SHA256SUMSv5.0.0 on GitHub with attached assetsCI / automated release (after pushing this repo to GitHub):
| Trigger | Workflow | Result |
|---|---|---|
Push to main / PR |
ci.yml |
Build Android, verify, upload dist/ artifact |
Push tag v* |
release.yml |
Full build + GitHub Release |
| Manual | Actions → Release → Run workflow | Same as tag release (optional draft) |
git tag v5.0.0 && git push origin v5.0.0
Starting November 2025, Google Play requires all native libraries to support 16KB page sizes on Android 15+ devices. This repo uses:
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true in Application.mkAPP_PLATFORM := android-35The verify:android task checks the alignment of the output .so files.
All versions are pinned in deps.json:
| Library | Version | Purpose |
|---|---|---|
| SpatiaLite | 5.0.0 | Spatial SQL extension for SQLite |
| GEOS | 3.7.2 | Geometry engine |
| PROJ | 6.1.1 | Coordinate transformation |
| SQLite | 3.28.0 | Database engine (amalgamation) |
| libiconv | 1.16 | Character encoding |
| libxml2 | 2.9.2 | XML parsing |
| JSON-C | 0.12 | JSON support |
| librttopo | 20180125 | RT Topology |
| XZ/LZMA | 5.2.4 | Compression |
| Task | Description |
|---|---|
mise run fetch |
Download all dependency sources |
mise run build:android |
Build for Android (all ABIs) |
mise run build:ios |
Build for iOS (device + simulator) |
mise run build:all |
Build for both platforms |
mise run verify:android |
Verify Android binaries |
mise run package |
Zip libs to dist/ + checksums |
mise run release -- <ver> |
Package and create a GitHub release |
mise run release:package -- <ver> |
Package only (no gh) |
mise run release:draft -- <ver> |
Draft GitHub release (CI-friendly with --yes) |
mise run clean:android |
Remove Android build output |
mise run clean:ios |
Remove iOS build output |
mise run clean:vendor |
Remove downloaded sources |
mise run clean:all |
Remove everything generated |
mise run info |
Show dependency versions and build status |
SpatiaLite is licensed under the MPL tri-license (MPL 1.1, GPL 2.0+, LGPL 2.1+). GEOS, PROJ, and other dependencies have their own open-source licenses. See each library's source for details.